<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" href="/res/app/admin/css/common.css" rel="stylesheet" />
<script type="text/javascript" src="/res/js/lib/jquery.js"></script>
<script type="text/javascript" src="/res/frame/js/t_thickbox.js"></script>
<script type="text/javascript" src="/res/js/lib/jquery.upload.js"></script>
<script type="text/javascript" src="/res/frame/js/select.js"></script>

<title>编辑线路主信息</title>

</head>
<body>

<form action="{url}" method="post">
    
        <table summary="Form table" border="1"  cellpadding="2"  width="100%"cellspacing="1">
            <tr>
            <td style="border-style: none;"><font color="#ffffff"><b>添加或编辑</b></font></td>
            </tr>
        <tr>
            <td style="border-style: none;">
            <fieldset>
                    <table>
                    <tr>
                        <td align="right"><b>线路名:</b></td>
                        <td>
                            <input type="text" style="width: 470px;" name="name" id="name" value="{route.name}"/>
                            <input type=radio name="special_point" value='0' onclick="special_point_f(this);" />无
                            <input type=radio name="special_point" value='1' onclick="special_point_f(this);" />推荐
                            <input type=radio name="special_point" value='2' onclick="special_point_f(this);" />热卖
                            <input type=radio name="special_point" value='3' onclick="special_point_f(this);"/>特价
                            <br />
                            <div style="display:none" id="suggest">
                            推荐词:<br /><textarea name="suggest_word" id="suggest_word" style="width:470px" cols="" rows="">{route.suggest_word}</textarea>
                            </div>
                            <script>
                                var special_point='{route.special_point}'*1;
                                $(":radio[name='special_point'][value='"+special_point+"']").attr('checked',true); 
                                if(special_point==1)
                                {
                                    $("#suggest").css("display","block");
                                }
                                function special_point_f(obj)
                                {
                                    var v = $(obj).attr("value");
                                    if(v==1)
                                    {
                                        $("#suggest").css("display","block");
                                    }else{
                                        $("#suggest").css("display","none");
                                    }
                                }
                            </script>
                            
                        </td>
                    </tr>
                    <tr  >
                        <td align="right"><b></b></td>
                        <td>
                            
                        </td>
                    </tr>
                    <tr>
                        <td align="right"><b>出发城市:</b></td>
                        <td>
                            <select id="start_city" name="start_city" >
                            <option value="0">选择出发城市</option>
                            <option value="1602">南京</option>
                            <option value="200">北京</option>
                             <option value="102">合肥</option>
                            <option value="1610">连云港</option>
                            <option value="1621">盐城</option>
                            <option value="2500">上海</option>        
                            <option value="1615">苏州</option>
                            <option value="1619">无锡</option>
                        </select>
                            <input type="hidden" style="width: 470px;" name="aim_city" id="aim_city" value="0"/>
                         
                            <script>
                              $("#start_city").val('{route.start_city}');
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <td align="right"><strong>线路特色:</strong></td>
                        <td>
                            <textarea rows="20" style="width: 470px;" id="describ" name="describ">{route.describ}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td align="right"><strong>行程天数:</strong></td>
                        <td>
                             <input type="text" style="width: 470px;" name="schedule_days" id="schedule_days" value="{route.schedule_days}"/>
                        </td>
                    </tr>
                     <tr style="display:none">
                        <td align="right"><strong>供应商</strong></td>
                        <td>
                             <input type="text" style="width: 470px;" name="agency_id" id="agency_id" value="{route.agency_id}"/>
                        </td>
                    </tr>
                     <tr style="display:none">
                        <td align="right"><strong>分类</strong></td>
                        <td>
                              <select id = "s_route" name = "s_route"></select>
                              <input type="hidden" style="width: 470px;" name="route_type" id="route_type" value="{route.route_type}"/>
                            
                            <script >
                            var json = {type_json};
                            getSelectOne(json,'s_route');
                            $("#s_route").attr("value",'{route.route_type}');               
                            </script>
                        </td>
                    </tr>
                    </table>
                
                    
                    
                 
           </fieldset>
        </td>
        </tr>
        
        <tr>
            <td style="border-style: none;">
            <fieldset>
                <legend ></legend>
                
                    <input type="button" value="添 加 或者 修 改" onclick="submit_form();" />
                
           </fieldset>
            </td>
        </tr>
    </table>
  
</form>
<script>
                    
                        /*提交表单*/
                        function submit_form()
                        {
                            var data = new Array();
                            data['form[id]']='{route.id}';
                            data['form[name]']=$("#name").val();
                            data['form[start_city]']=$("#start_city").val();
                            data['form[aim_city]']=$("#aim_city").val();
                            data['form[describ]']=$("#describ").val();
                            var lent = data['form[describ]'].length;
                            if(lent*1 > 178)
                            {
                                data['form[describ]'] = data['form[describ]'].substring(0,178);
                            }
                            data['form[schedule_days]']=$("#schedule_days").val();
                            data['form[agency_id]']=$("#agency_id").val();
                            data['form[route_type]']=$("#route_type").val();
                            data['form[special_point]']=$(":radio[name='special_point'][checked]").val();
                            data['form[suggest_word]'] =$("#suggest_word").val();
                            var data_str='';
                            for(i in data)
                            {
                                data_str +=i+'='+data[i]+'&';
                            }
                            data_str += "cache="+Math.random();
                            //alert(data_str);return;
                            $.ajax({
                                    url:'{url}',
                                    data:data_str,
                                    //dataType:'json',
                                    type:'post',
                                    success:function(json){
                                    if (json == 1)
                                        {
                                            alert("成功");
                                        }else if (json > 1){
                                                alert ("成功");
                                                window.location.href="/adminweb/w-route/showRoute?id="+json;
                                            }else {
                                                alert ("失败");
                                                }
                                    }
                                });
                        }
                    
                    </script>
                    
</body>

</html>
	    